<template>
  <div id="myTab">


    <mt-header fixed  :title="title"></mt-header>

    <!--内容-->
    <div class="page-tab-container">
      <mt-tab-container class="page-tabbar-tab-container" v-model="active">
        <mt-tab-container-item id="tab1">
          okla start<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          home<br>
          hello<br>
          hello<br>
          hello<br>
          hello<br>
          hello<br>
          hello<br>
          hello<br>
          hello<br>
          hello<br>
          hello<br>
          hello<br>
          okla end <br>
        </mt-tab-container-item>

        <mt-tab-container-item id="tab2">
          order
        </mt-tab-container-item>

        <mt-tab-container-item id="tab3">
          discovery
        </mt-tab-container-item>

        <mt-tab-container-item id="tab4">
          mine
        </mt-tab-container-item>
      </mt-tab-container>
    </div>

    <!--底部的tabbar-->
    <mt-tabbar v-model="selected" fixed>
      <mt-tab-item id="home" @click.native.prevent="active = 'tab1'">
        <img slot="icon" src="../assets/logo.png">
        home
      </mt-tab-item>
      <mt-tab-item id="order" @click.native.prevent="active = 'tab2'">
        <img slot="icon" src="../assets/logo.png">
        order
      </mt-tab-item>
      <mt-tab-item id="discovery" @click.native.prevent="active = 'tab3'">
        <img slot="icon" src="../assets/logo.png">
        discovery
      </mt-tab-item>
      <mt-tab-item id="mine" @click.native.prevent="active = 'tab4'">
        <img slot="icon" src="../assets/logo.png">
        mine
      </mt-tab-item>
    </mt-tabbar>
  </div>
</template>

<script>
  import { Header, Tabbar, TabItem, TabContainer, TabContainerItem } from 'mint-ui'

  export default {
    name: 'myTab',
    data () {
      return {
        selected: 'home',
        active: 'tab1',
        title: 'Home'
      }
    },
    created () {
    },
    watch: {
      selected: function (val, oldVal) {
        // 这里就可以通过 val 的值变更来确定
//        console.log(val)
        this.title = val
//        this.$set('title', 'hello world')
//        console.log(this.$refs.title.title)
        console.log(val)
      }
    },
    components: {
      MtHeader: Header,
      MtTabbar: Tabbar,
      MtTabItem: TabItem,
      MtTabContainer: TabContainer,
      MtTabContainerItem: TabContainerItem
    }
  }
</script>

<style scoped>
  .page-tab-container{
    margin-top: 40px;
    margin-bottom: 55px;
  }

</style>
